home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1993 by Jon Dart. All Rights Reserved.
-
- #include "pinfo.h"
- #include <assert.h>
-
- Position_Info::Position_Info( const Board &board, int rep_count )
- {
- my_hashcode = board.HashCode();
- int16 x = (int16)(board.CastleStatus(Black));
- int16 y = (int16)(board.CastleStatus(White));
- int16 z = (int16)(board.EnPassantSq(board.OppositeSide()));
- my_xhashcode = x | (y << 3) | (z << 8) | (rep_count << 6);
- if (board.Side() == Black)
- my_xhashcode |= 0x8000;
- }
-
- Position_Info::Position_Info( const Board &board, const int depth,
- const ValueType hashflags,
- const Boolean forced,
- const int rep_count,
- const int value,
- const Move &best_move)
- : my_depth((signed char)depth),
- my_hashcode(board.HashCode()),
- my_value(value),my_best_move(best_move)
- {
- my_flags = (byte)hashflags;
- if (forced)
- my_flags |= 0x80;
- assert(rep_count <= 3);
- // The "xhashcode" byte holds info on castling and en passant
- // status.
- int16 x = (int16)(board.CastleStatus(Black));
- int16 y = (int16)(board.CastleStatus(White));
- int16 z = (int16)(board.EnPassantSq(board.OppositeSide()));
- my_xhashcode = x | (y << 3) | (z << 8) | (rep_count << 6);
- if (board.Side() == Black)
- my_xhashcode |= 0x8000;
- }
-
- unsigned long hash_code(const Position_Info &p)
- {
- return p.hash_code();
- }
-
-